﻿/*
 * Created by SharpDevelop.
 * User: Propriétaire
 * Date: 14/07/2012
 * Time: 09:51
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Windows.Forms;

namespace IPD_GeneralLib
{
    /// <summary>
    /// Class with program entry point.
    /// </summary>
    internal sealed class Program
    {
        /// <summary>
        /// Program entry point.
        /// </summary>
        [STAThread]
private static void Main(string[] args)
 {
    splitargv(args) ;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
 }
		
private static void splitargv(string[] args)
 {
  IPD_GeneralLib.IPDGeneral.iInterfaceLanguage = -1 ;
  int nbargs = args.Length ;
  if (nbargs == 0 )
     return ;
  if (nbargs % 2 != 0) // Impair
     return ;
     
  string fname = "-f" ;
  string lng = "-lng" ;
  string sdir = "-dir" ;
  
  for (int ii = 0 ; ii < nbargs / 2 ; ii += 2)
      {
       if (args[ii + 0].ToLower() == fname.ToLower())
           MainForm.ARGVFNAME = args[ii + 1] ;
       if (args[ii + 0].ToLower() == sdir.ToLower())
           MainForm.ARGVDIR = args[ii + 1] ;
       if (args[ii + 0].ToLower() == lng.ToLower())
           {
             if (args[ii + 1] == "0")
                IPD_GeneralLib.IPDGeneral.iInterfaceLanguage = 0 ;
                     else {
                            if (args[ii + 1] == "1")
                               IPD_GeneralLib.IPDGeneral.iInterfaceLanguage = 1 ;
                                  else IPD_GeneralLib.IPDGeneral.iInterfaceLanguage = -1 ;
                        }
         }
    }
}
        
  }
}
